/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package core;

import java.util.ArrayList;
import java.util.Collection;

/**
 *
 * @author Ahlberg
 */
public class School extends SuperSchool
{

    private String XMLSource;
    private Collection<Program> programs;
    private Collection<Course> courses;
    /**
     * Default constructor.
     */
    public School()
    {        
    }
    /**
     *
     * @param XMLSource
     */
    public School(String XMLSource)
    {
        super();
        this.XMLSource = XMLSource;
        programs = new ArrayList<Program>();
        courses = new ArrayList<Course>();
    }
    /**
     *
     * @param id
     * @param name
     * @param description
     * @param webLink
     * @param XMLSource
     */
    public School(long id, String name,
            String description, String webLink, String XMLSource){

        super(id, name, description, webLink);
        this.XMLSource = XMLSource;
        this.programs = new ArrayList<Program>();
        this.courses = new ArrayList<Course>();;
    }
    /**
     *
     * @param id
     * @param name
     * @param description
     * @param webLink
     * @param XMLSource
     * @param programs
     * @param courses
     */
    public School(long id, String name,
            String description, String webLink, String XMLSource, Collection<Program> programs, Collection<Course> courses){

        super(id, name, description, webLink);
        this.XMLSource = XMLSource;
        this.programs = programs;
        this.courses = courses;
    }
    /*
     *  Get methods
     */
    /**
     *
     * @return
     */
    public String getXMLSource()
    {
        return XMLSource;
    }
    /**
     *
     * @return
     */
    public Collection<Program> getPrograms(){
        return programs;
    }
    /**
     * 
     * @return
     */
    public Collection<Course> getCourses(){
        return courses;
    }

    /*
     *  Set methods
     */
     /**
      *
      * @param XMLSource
      */
    public void setXMLSource(String XMLSource)
    {
        this.XMLSource = XMLSource;
    }
    /**
     *
     * @param programs
     */
    public void setPrograms(Collection<Program> programs){
        this.programs = programs;
    }
    /**
     *
     * @param courses
     */
    public void setCourses(Collection<Course> courses){
        this.courses = courses;
    }

    /*
     *   Other methods
     */
     /**
      *
      * @param program
      * @return
      */
     public boolean addProgram(Program program){
         return programs.add(program);
     }
     /**
      *
      * @param course
      * @return
      */
     public boolean addCourse(Course course){
         return courses.add(course);
     }
     /**
      *
      * @param program
      * @return
      */
    public boolean removeProgram(Program program)
    {
         return programs.remove(program);
    }
    /**
     *
     * @param course
     * @return
     */
    public boolean removeCourse(Course course)
    {
         return courses.remove(course);
    }
    /**
     *
     * @param s
     * @return
     */
    public boolean equals(School s)
    {
        return super.equals(s);
    }
    /**
     *
     * @return
     */
    @Override
    public String toString()
    {
        String str = super.toString();
        str +=  "XMLSource: " + XMLSource + "\n";
        str += "PROGRAMS:\n";
        for(Program p : programs)
            str += p.toString();
        str += "COURSES:\n";
        for(Course c : courses)
            str += c.toString();
        return str;
    }
}
